import type { PropType } from 'vue'
import type { ExtrackExpose, ExtractProps } from '@/utils/type'
import styleVar from '@/styles/variable.module.scss'
import { toStrFirstCase } from '@/utils'
import { Popup } from '@/components'
import type Com from './index.vue'

type Btn = Partial<(Popup.Props['btns'] & {})[number] & { show: boolean }>
namespace ConfirmPopup {
  export const name = toStrFirstCase(`${styleVar.namespace}ConfirmPopup`)
  export const props = {
    popupProps: Object as PropType<Omit<Popup.Props, 'title'>>,
    /**
     * 提示内容
     */
    prompt: String,
    /**
     * 取消按钮
     */
    cancelBtn: Object as PropType<Btn>,
    /**
     * 确认按钮
     */
    confirmBtn: Object as PropType<Btn>,
    /**
     * 标题
     */
    title: String
  }
  type BaseProps = ExtractProps.Types<typeof props>
  export type Props = BaseProps
  export const Component = <{
    new(): {
      $props: Props
    }
  }>{}
  export type Instance = ExtrackExpose.Types<typeof Com>
}
export default ConfirmPopup